#pragma once

#include <ctime>
#include <string>

/*
 * Functions to work with timing and dates
 * Dependencies: bzbtime
 */

namespace bzbtime {

struct time {

	public:
		int year;
		int month;
		int day;
		int hour;
		int min;
		int sec;

		/*
		 * Default constructor
		 */

		inline time() : year(0), month(0), day(0), hour(0), min(0), sec(0) {}

		/*
		 * Constructs using the std::tm structure
		 * If nullptr, fields are initialized to 0
		 */
		explicit time(std::tm *right_now);


		/*
		 * Returns the formatted date and time
		 * e.g. "YY/MM/DD hh:mm:ss"
		 * Format codes are:
		 *   - YY year
		 *   - MM month
		 *   - DD day
		 *   - hh hour
		 *   - mm minute
		 *   - ss second
		 */

		std::string to_string(const std::string &format) const;
};


/*
 * Returns a bzbtime::time structure containing the local time
 */

bzbtime::time get_localtime();

}
